#include "StdAfx.h"
#include ".\mfcwpfrecttext.h"

CMFCWPFRectText::CMFCWPFRectText(void)
{
}

CMFCWPFRectText::~CMFCWPFRectText(void)
{
}

///<summary>
///Get Node Attributes from the xaml file using the path and
///calculate the element's rect and
///get the element's content
///</summary>
///<param name='szPath'>
///the path in the xaml file
///</param>
///<param name='pXmlParser'>
///the pointer to the xml parser
///</param>
///<param name='oRect'>
///the region of the element that contains this element
///</param>
void CMFCWPFRectText::Parse(const CString & szPath, CECGXmlParser * pXamlParser, const CRect & oRect)
{
	CMFCWPFRect::Parse(szPath, pXamlParser, oRect);
	pXamlParser->GetNodeContent(szPath, m_szContent);
}

///<summary>
///Draw the element's background and text in the context of pCDCPlus 
///according to the "IsEnabled" attribute
///</summary>
///<param name='pCDCPlus'>
///the pointer to the GDI+ display context
///</param>
///<returns>
///true if the element is enabled; false otherwise
///</returns>
bool CMFCWPFRectText::DrawSelf(CDCPlus * pCDCPlus)
{
	if (CMFCWPFRect::DrawSelf(pCDCPlus))
	{
		CString szColorName = _ATTRIBUTEVALUEBLACK;
		pCDCPlus->SetTextColor(m_oAttributes.GetColorFromName(szColorName));
		pCDCPlus->SetFontPlus(_FONTTYPE, 28, FontStyleRegular);
		pCDCPlus->DrawTextPlus(m_szContent, m_oRect, DT_LEFT);
		return true;
	}
	return false;
}

///<summary>
///Set the element's content
///</summary>
///<param name='szContent'>
///the content to be set to the element
///</param>
void CMFCWPFRectText::SetContent(const CString & szContent)
{
	m_szContent = szContent;
}

///<summary>
///Getet the element's content
///</summary>
///<returns>
///the content of the element
///</returns>
CString CMFCWPFRectText::GetContent()
{
	return m_szContent;
}
